package com.lanou.timeline.comment.web.controller;

import com.lanou.timeline.comment.entity.TimelineComment;
import com.lanou.timeline.comment.service.impl.TimelineCommentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/timelinecomment")
public class TimelineCommentController {
    @Autowired
    private TimelineCommentServiceImpl timelineCommentServiceImpl;

    /**
     * 发表评论
     */
    @PostMapping("/publish")
    public void publishComment(TimelineComment timelineComment){
        timelineCommentServiceImpl.publishComment(timelineComment);
    }
    /**
     * 显示碎片所有评论
     */
    @GetMapping("/showcomment")
    public List<TimelineComment> showComment(String timelineId){
        return timelineCommentServiceImpl.showComment(timelineId);
    }
    /**
     * 举报评论
     */
    @PutMapping("/reportcomment")
    public void reportComment(String tagCommentId){
        timelineCommentServiceImpl.reportComment(tagCommentId);
    }
    /**
     * 点赞及取消点赞评论
     */
    @PutMapping("/updateIsgood")
    public void updateIsgood(String tagCommentId,int uid){
        timelineCommentServiceImpl.updateIsgood(tagCommentId,uid);
    }
    /**
     * 删除评论
     */
    @DeleteMapping("/deletecomment")
    public void deleteComment(String tagCommentId,int uid){
        timelineCommentServiceImpl.deleteComment(tagCommentId,uid);
    }

}
